<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/TemplateAdmin.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="ManageBanking.Areas.Admin.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScrip" runat="server">

    <link href="../../../../Content/css/Stylesheet1.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/functions.js" type="text/javascript"></script>

    <script src="../../../../Scripts/wysiwyg.js" type="text/javascript"></script>
   
    <script src="../../../../Scripts/smartpaginator.js" type="text/javascript" ></script>

    <link href="../../../../Content/css/smartpaginator.css" rel="stylesheet" type="text/css" />
<script src="../../../../Scripts/JTPS.js" type="text/javascript"></script> 
      
    <script type="text/javascript" language="javascript">
          $(document).ready(function() {

              $('#empTable').jTPS({ clickCallback: function() {
                  // target table selector
                  var table = '#empTable';
                  // store pagination + sort in cookie 
                  document.cookie = 'jTPS=sortasc:' + $(table + ' .sortableHeader').index($(table + ' .sortAsc')) + ',' +
                                                'sortdesc:' + $(table + ' .sortableHeader').index($(table + ' .sortDesc')) + ';';
                  $('.stubCell').remove();
              }
              });


              // reinstate sort and pagination if cookie exists
              var cookies = document.cookie.split(';');
              for (var ci = 0, cie = cookies.length; ci < cie; ci++) {
                  var cookie = cookies[ci].split('=');
                  if (cookie[0] == 'jTPS') {
                      var commands = cookie[1].split(',');
                      for (var cm = 0, cme = commands.length; cm < cme; cm++) {
                          var command = commands[cm].split(':');
                          if (command[0] == 'sortasc' && parseInt(command[1]) >= 0) {
                              $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click();
                          } else if (command[0] == 'sortdesc' && parseInt(command[1]) >= 0) {
                              $('#empTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click().click();
                          }
                      }
                  }
              }
              $('.stubCell').remove();
              // bind mouseover for each tbody row and change cell (td) hover style
              $('#empTable tbody tr:not(.stubCell)').bind('mouseover mouseout',
                                function(e) {
                                    // hilight the row
                                    e.type == 'mouseover' ? $(this).children('td').addClass('hilightRow') : $(this).children('td').removeClass('hilightRow');
                                }
                        );

          });

     
 </script>
   
    
    <script type="text/javascript">
        $(document).ready(function() {

            $("select#perpage").change(function() {
                var str;
                $("select option:selected").each(function() {
                    str = parseInt($(this).text());
                });


                $('#red').smartpaginator({ totalrecords: $('input#totaluser').attr('value'), recordsperpage: str, length: 4, datacontainer: 'empTable', dataelement: 'tr', next: 'Next', prev: 'Prev', first: 'First', last: 'Last', theme: 'black', controlsalways: true, onchange: function(newPage) {
                    $('#r').html('Page # ' + newPage);
                }
                });

                $('.short').remove();


            }).change();

            
        });
    </script>
    
    <!------ search ------->
    <script type="text/javascript">
        $(document).ready(function() {
            $('ul#search_user').remove();
            $('ul#search_user1').show();

            // check update
            $('input.icon-1').click(function() {
                return confirm('Are you sure Update ?');
            });
            
            
        });
    </script>
    <!-------- End Search------------->
    
    
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

   

    <% if (ViewData["Res"] == "true")
       {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Your Action Is Success</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Res"] !=null)
      { %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Res"] %></p>
					</div>
				</div>
				<%} %>
				
   
	<table id="empTable" border="0"  cellpadding="0" cellspacing="0" >
	<thead>
	<tr>
		<th sort="index" class="table-header-check th-usernamerequest" ><a>Name User</a></th>
		<th align="center" sort="description" class="table-header-repeat line-left th-nam"><a>Name Admin</a></th>
		<th sort="description" class="table-header-repeat line-left th-typerequest"><a>TypeRequest</a></th>
		<th align="center" sort="description" class="table-header-repeat line-left th-date"><a>Date</a></th>
		<th class="table-header-repeat line-left th-solved" ><a>Solved</a></th>
		<th class="table-header-options2 line-left options-request"><a>Options</a></th>
	</tr>
	</thead>
	<tbody>
	<%  int dem = 1;
        List<RequestAdmin> lun = (List<RequestAdmin>)ViewData["listuser"];
        ManageAdminModels ma = new ManageAdminModels();   
        foreach(RequestAdmin un in lun ) 
        {
            dem ++;
            if(dem%2==0)
            {%>
	            <tr>
		            <td ><%=ma.nameuser(un) %></td>
		            <td><%= ma.nameadmin(un) %></td>
		            <td ><%=un.IdType==1?"ForgotPass":"Unlock" %></td>
		       <td align="center" class="lock" ><%=un.DateCreate.Value.ToString("yyyy-MM-dd")%></td>
		            <td align="center" class="lock">
		                <% using (Html.BeginForm("Resolve", "ManageUserAdmin"))
                     {%>
                     
                        <input id="Hidden1" type="hidden" name="idrequest" value="<%=un.IdRequest %>" />
                        <input id="Hidden2" type="hidden" name="idtype" value="<%=un.IdType %>"/>
                    <%Username us = (Username)Session["Admin"]; %>
                       <input id="Hidden3" type="hidden" name="idadmin" value="<%=us.IdUsername %>"/>
                        <input id="Hidden4" type="hidden" name="idusername" value="<%=un.IdUsername %>"/>
                        <% if (Convert.ToBoolean(un.Solved) == true)
                           { %>
		                <select id="Select1" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Solved)==true ? "selected=selected" : "" %> disabled=disabled value="true">Solve</option>
		                    <option <%=  Convert.ToBoolean(un.Solved)==false ? "selected=selected" : "" %> disabled=disabled value="false">UnSolve</option>
		                </select>
		                <%} %>
		                <% if (Convert.ToBoolean(un.Solved) == false)
                           { %>
		                <select id="Select2" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Solved)==true ? "selected=selected" : "" %>  value="true">Solve</option>
		                    <option <%=  Convert.ToBoolean(un.Solved)==false ? "selected=selected" : "" %> value="false">UnSolve</option>
		                </select>
		                <%} %>
		                
		                <input type="hidden" name="idusername" value='<%= un.IdUsername %>' />
		               </td>
		            <td class="phuc3"  >
                        <input id="ud" type="submit"  value="" class="icon-1 phuc" title="Update" />
                        <%} %>
                        
                        
		            </td>
	            </tr>
	        <% }
	        else
	        {%>
	            <tr  class="alternate-row">
		            <td><%= ma.nameuser(un) %></td>
		            <td><%= ma.nameadmin(un) %></td>
		            <td><%= un.IdType==1?"ForgotPass":"Unlock"  %></td>
		       <td align="center" class="lock" ><%=un.DateCreate.Value.ToString("yyyy-MM-dd")%></td>
		            <td align="center" class="lock">
		           <% using (Html.BeginForm("Resolve", "ManageUserAdmin"))
                     {%>
                     <input id="Hidden5" type="hidden" name="idrequest" value="<%=un.IdRequest %>" />
                        <input id="Hidden6" type="hidden" name="idtype" value="<%=un.IdType %>"/>
                    <%Username us = (Username)Session["Admin"]; %>
                       <input id="Hidden7" type="hidden" name="idadmin" value="<%=us.IdUsername %>"/>
                        <input id="Hidden8" type="hidden" name="idusername" value="<%=un.IdUsername %>"/>
                        <% if (Convert.ToBoolean(un.Solved) == true)
                           { %>
		                <select id="Select3" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Solved)==true ? "selected=selected" : "" %> disabled="disabled" value="true">Solve</option>
		                    <option <%=  Convert.ToBoolean(un.Solved)==false ? "selected=selected" : "" %> disabled="disabled" value="false">UnSolve</option>
		                </select>
		                <%} %>
		                <% if (Convert.ToBoolean(un.Solved) == false)
                           { %>
		                <select id="Select4" name="lockuser">
		                    <option <%=  Convert.ToBoolean(un.Solved)==true ? "selected=selected" : "" %>  value="true">Solve</option>
		                    <option <%=  Convert.ToBoolean(un.Solved)==false ? "selected=selected" : "" %> value="false">UnSolve</option>
		                </select>
		                <%} %>
		                
		                <input type="hidden" name="idusername" value='<%= un.IdUsername %>' />
		               </td>
		            <td class="phuc3" >
                        <input id="ud1" type="submit"  value="" class="icon-1 phuc" title="Update" />
                        <%} %>
                        
                        
		            </td>
	            </tr>
	            
	<%  
            }
        }
	     %>
	     </tbody>
	</table>
	<!--  end product-table................................... --> 
	

    <!--  start paging..................................................... -->
	<div id="red" style="margin: auto;">
	     <input id="totaluser" type="hidden" value='<%= ViewData["totaluser"]%>'  />
	</div>
	
	<div id="drop" >
	    <select id="perpage" >   
            <option value="2">2</option>
			<option selected="selected" value="5">5</option>
			<option value="10">10</option>
			<option value="15">15</option>
			<option value="20">20</option>
			<option value="30">30</option>
		</select>
	</div>
    
	<!--  end paging................ -->

    
  
    

</asp:Content>


